/**
 * <p>Copyright:Copyright(c) 2019</p>
 * <p>Company:Professional</p>
 * <p>Package:com.cesgroup.zw.spring.boot.echarts.model.data</p>
 * <p>File:GraphData.java</p>
 * <p>类更新历史信息</p>
 * @todo chanlong(陈龙) 创建于 May 27, 2019 12:14:11 PM
 */
package com.cesgroup.zw.spring.boot.echarts.model.graph;

import com.cesgroup.zw.spring.boot.charts.model.IData;
import com.cesgroup.zw.spring.boot.echarts.component.Tooltip;
import com.cesgroup.zw.spring.boot.echarts.model.series.Emphasis;
import com.cesgroup.zw.spring.boot.echarts.model.style.ItemStyle;
import com.cesgroup.zw.spring.boot.echarts.model.style.LabelStyle;
import com.cesgroup.zw.spring.boot.echarts.model.style.SymbolStyle;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>描述: </p>
 * <p>Company: Professional</p>
 * @author chanlong(陈龙)
 * @date May 27, 2019 12:14:11 PM
 * @version 1.0.2019
 */
@Data @SuppressWarnings("serial")
@EqualsAndHashCode(callSuper = true)
public class GraphData extends SymbolStyle implements IData {

	/** 节点名称 */
	private String name;
	
	/** 节点的初始 x 值 */
	private Integer x;
	
	/** 节点的初始 y 值 */
	private Integer y;
	
	/** 节点在力引导布局中是否固定 */
	private Boolean fixed;
	
	/** 数据项值 */
	private Object value;
	
	/** 数据项所在类目的 index */
	private Integer category;
	
	/** 单个图形样式 */
	private ItemStyle itemStyle;
	
	/** 单个图形的标签样式 */
	private LabelStyle label;
	
	/** 单个图形的高亮样式 */
	private Emphasis emphasis;
	
	/** 单个图形的提示组件 */
	private Tooltip tooltip;

	/**是否能被拖拽 默认false*/
	private boolean draggable;
	
	public GraphData(final String name) {
		this.name = name;
	}
	
	public GraphData(final String name, final Integer category) {
		this(name);
		this.category = category;
	}
	
	public GraphLink toLink(final String source) {
		GraphLink link = new GraphLink(source, name); 
		link.setValue(value);
		return link;
	}
}
